package services.dingtalk

import javax.inject.Inject
import play.api.Logging

import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext, Future}

class DingtalkTasks @Inject()(dingtalkContent: ContentUpdateService
                             )(implicit exec: ExecutionContext) extends Logging {
  def contentUpdateTask(company: String = "default", upAll: Boolean = false) = {
      //    dingtalkContent.updateUserInfo("wuyang",upAll)
      if (DingtalkService.companyNum(company) == 100) Future("company not find!")
      else //Await.result( dingtalkContent.updateDingtalkUsers(company,upAll),Duration.Inf)
        dingtalkContent.updateDingtalkUsers(company, upAll)
      //    dingtalkContent.updateUserInfo("lidun",upAll)
  }
}
